<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>
        <ui:composition template="../templates/default3.xhtml">
            <ui:define name="content">
                <h:form id="manageWarehouseZones" binding="#{warehouseManagerBean.loadManageWarehouseZones}">
                   <p:messages />
                    <p:panel header="Production Batch information" id="productionBatch" rendered="#{warehouseManagerBean.isUpdate}">
                        <table>
                            <tr>
                                <td>
                                    Production Batch:
                                </td>
                                <td>
                                    <h:outputText value="#{warehouseManagerBean.productionBatch.product.name}"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Quantity:
                                </td>
                                <td>
                                     <h:outputText value="#{warehouseManagerBean.productionBatch.quantity}"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Weight per bar (g):
                                </td>
                                <td>
                                      <h:outputText value="#{warehouseManagerBean.productionBatch.product.weight}"/>
                                </td>
                            </tr>
                            
                            <tr>
                                <td>
                                    Total weight (KG):
                                </td>
                                <td>
                                     <h:outputText value="#{warehouseManagerBean.totalWt}"/>
                                </td>
                            </tr>
                            
                        </table>
                        
                    </p:panel>
                        
                           <p:panel header="Select warehouse zone" id="selectWarehouseZones" >
                        <p:dataTable id="warehouseZones" var="warehouseZone" value="#{warehouseManagerBean.warehouseZones}" selectionMode="single" 
                                     selection="#{warehouseManagerBean.selectedWarehouseZone}" paginator="true" rows="10"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" >
                            <p:column filterBy="#{warehouseZone.zoneName}" headerText="Name" filterMatchMode="contains">  
                                <h:outputText value="#{warehouseZone.zoneName}" />  
                            </p:column> 
                            <p:column filterBy="#{warehouseZone.type}" headerText="Type" filterMatchMode="contains">  
                                <h:outputText value="#{warehouseZone.type}" />  
                            </p:column> 
                            <p:column filterBy="#{warehouseZone.quantityLimit}" headerText="Quantity Limit" filterMatchMode="contains">  
                                <h:outputText value="#{warehouseZone.quantityLimit}" />  
                            </p:column>
                            <p:column filterBy="#{warehouseZone.currentQuantity}" headerText="Current Quantity" filterMatchMode="contains">  
                                <h:outputText value="#{warehouseZone.currentQuantity}" />  
                            </p:column> 
                        </p:dataTable>
                        <table class="table-submit">
                            <tr>
                                <td align="center">
                                    <p:commandButton id="btnUpdateAWarehouseZone" value="Update Warehouse Zone" 
                                                     title="Update selected warehouse zone." ajax="true"
                                                     update="rawMaterialsPanel"
                                                     actionListener="#{warehouseManagerBean.updateWarehouseZone}" rendered="#{warehouseManagerBean.notUpdate}" />
                                    <p:commandButton id="btnUpdateProductionBatch" value="Move to Zone" 
                                                     title="Move production batch to selected warehouse zone." ajax="true"
                                                     update="rawMaterialsPanel"
                                                     actionListener="#{warehouseManagerBean.updateProductionBatch}" rendered="#{warehouseManagerBean.isUpdate}" />
                                    
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
